package net.sf.rose.business.bean.control.judge;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;

/**
 * @author fengjian
 * @since 2014-5-25
 * 
 */
public class JudgeStatement {

	/** 主键编号 */
	@Attribute
	private int id = -1;

	/** 说明 */
	@Element
	private String description = null;

	/** 判断类型：4.数据；3.用户；2.角色；1.工作组 */
	@Attribute
	private int type = 1;
	@Attribute
	private String typeString = null;

	/** 执行IF判断表达式语句 */
	@Element
	private String expression = null;

	/** 数据项名称 */
	@Element(required = false)
	private String dataName = null;

	/** 比较符 */
	@Element(required = false)
	private String compareTag = null;

	/** 比较值 */
	@Element(required = false)
	private String compareVal = null;

	/** -1：隐藏,0：未定义,1：显示,2：编辑 */
	public static String power_hide = "-1";
	public static String power_undefined = "0";
	public static String power_display = "1";
	public static String power_edit = "2";
	/** 比较结果值 */
	@Element(required = false)
	private String power = null;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
		if (type == 4) {
			this.typeString = "数据";
		} else if (type == 3) {
			this.typeString = "用户";
		} else if (type == 2) {
			this.typeString = "角色";
		} else if (type == 1) {
			this.typeString = "工作组";
		}
	}

	public String getTypeString() {
		return typeString;
	}

	public void setTypeString(String typeString) {
		this.typeString = typeString;
		if (typeString.equals("数据")) {
			this.type = 4;
		} else if (typeString.equals("用户")) {
			this.type = 3;
		} else if (typeString.equals("角色")) {
			this.type = 2;
		} else if (typeString.equals("工作组")) {
			this.type = 1;
		}
	}

	public String getExpression() {
		return expression;
	}

	public void setExpression(String expression) {
		this.expression = expression;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDataName() {
		return dataName;
	}

	public void setDataName(String dataName) {
		this.dataName = dataName;
	}

	public String getCompareTag() {
		return compareTag;
	}

	public void setCompareTag(String compareTag) {
		this.compareTag = compareTag;
	}

	public String getCompareVal() {
		return compareVal;
	}

	public void setCompareVal(String compareVal) {
		this.compareVal = compareVal;
	}

	public String getPower() {
		return power;
	}

	public void setPower(String power) {
		this.power = power;
	}

	public String toString() {
		return this.description;
	}

}
